package com.hexacta.hrs.web.struts.actions.staffing;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;
import org.apache.struts2.interceptor.validation.SkipValidation;
import org.vectrics.cv.Level;
import org.vectrics.cv.Skill;
import org.vectrics.provider.CoreServiceLocator;
import org.vectrics.recruiter.RecruitServiceLocator;
import org.vectrics.recruiter.job.JobFunction;
import org.vectrics.user.Person;

import com.hexacta.hrs.domain.staffing.Project;
import com.hexacta.hrs.domain.staffing.Requirement;
import com.hexacta.hrs.domain.staffing.RequirementSkills;
import com.hexacta.hrs.securitygroups.PermissionNameConverter;
import com.hexacta.hrs.service.staffing.ProjectService;
import com.hexacta.hrs.web.struts.actions.security.PermissionChecker;
import com.opensymphony.xwork2.ActionSupport;

public class RequirementAction extends ActionSupport implements SessionAware , ServletRequestAware {

	private static final String PREREQUIREMENTS = "preRequirements";

	private static final long serialVersionUID = 993786899395795283L;

	private static final String CREATE = "createRequirement";
	private static final String EDIT = "editRequirement";
	private static final String MANAGE = "manageRequirement";
	private static final String CONFIRM_CREATE = "confirmCreateRequirements";
	private static final String REMOVE = "removeRequirement";

	private static final String REQUIREMENT_FILTER = "requirementFilter";

	public static final String SUCCESS = "success";
	
	private PermissionChecker permissionChecker = new PermissionChecker();
	private PermissionNameConverter permissionNameConverter = new PermissionNameConverter();
	private HttpServletRequest request;
	
	private ProjectService projectService;
	private Map session;
	private String mappedRequest;
	private long requestId;
	private Collection<String> selectedRolesBefore = new ArrayList<String>();
	private boolean readOnly = false;
	private Boolean validated = Boolean.FALSE;
	
	private Collection<Skill> skillsList = new ArrayList<Skill>();
	
	// Valores ingresados en el From
	private String selectedProjectName;
	private String selectedProjectId;
	private String selectedRoleCode;
	private String selectedRoleName;
	private Date selectedStartDate;
	private Date selectedEndDate;
	private String selectedProcentage;
	private String selectedRoles;
	private Collection<Requirement> preRequirements = new ArrayList<Requirement>();
	private Collection<Requirement> filteredRequirementList = new ArrayList<Requirement>();
	private Project project;
	private String requirementId;
	private String requirementToDelete;

	// Valores para la pantalla de Edit o Create
	private String requirementProjectId;
	private String requirementProjectName;
	private String requirementRoleCode;
	private String requirementRoleName;
	private Date requirementFromDate;
	private Date requirementToDate;
	private String requirementPercentage;


	public HttpServletRequest getRequest() {
		return request;
	}

	public void setRequest(HttpServletRequest request) {
		this.request = request;
	}

	@SkipValidation
	public final String createRequirement() {
		this.initPreRequirements();
		this.setProject(this.getProjectService().searchById(
				Long.parseLong(this.getSelectedProjectId())));
		this.setRequirementFromDate(this.getProject().getDateStart().getTime());
		Calendar dateEnd = this.getProject().getDateEnd();
		if (dateEnd != null) {
			this.setRequirementToDate(dateEnd.getTime());
		}
		this.setRequirementProjectId(this.getSelectedProjectId());
		this.setRequirementProjectName(this.getSelectedProjectName());
		this.setPreRequirements(new ArrayList<Requirement>());
		setMappedRequest(CREATE);
		return SUCCESS;
	}

	@SkipValidation
	public final String manageRequirement() {
		setMappedRequest(MANAGE);
		return SUCCESS;
	}

	@SkipValidation
	public final String projectSelected() {
		this.loadInitialValues();
		this.loadRequirementList();
		this.saveRequirementFiltersInSession();
		setMappedRequest(MANAGE);
		return SUCCESS;
	}

	/** @return {@link Person} logueado */
	protected Person getAuthPerson() {
		Person person = CoreServiceLocator.getUserAuthService()
				.getAuthorizedPerson(this.request.getSession());
		return (person);
	}
	
	
	
	public boolean hasPermission(String permission) {
		return getPermissionChecker().hasPermission(permission,
				this.request.getSession());
	}
	
	private void loadRequirementList() {
		this.setFilteredRequirementList(this.getProjectService()
				.findRequirements(Long.parseLong(this.getSelectedProjectId()),
						this.getSelectedStartDate(), this.getSelectedEndDate(),
						this.getSelectedRolesBefore()));
	}

	@SkipValidation
	public final String removeRequirement() {
		this.loadRequirementFiltersFromSession();
		this.loadSelectedRolesBefore();
		Requirement requirement = null;
		this.setProject(this.getProjectService().searchById(
				Long.parseLong(this.getSelectedProjectId())));
		Project project = this.getProject();
		for (Requirement req : project.getRequirements()) {
			if (req.getId().equals(
					Long.parseLong(this.getRequirementToDelete()))) {
				requirement = req;
				break;
			}
		}
		if(requirement != null){
			project.removeRequirement(requirement);

			this.getProjectService().save(project);
			
			this.saveRequirementFiltersInSession();
			setMappedRequest(REMOVE);
			return SUCCESS;
			}else{
				return SUCCESS;
				
			}
	}

	private void saveRequirementFiltersInSession() {
		RequirementFilters filter = new RequirementFilters();
		filter.setStartDate(this.getSelectedStartDate());
		filter.setEndDate(this.getSelectedEndDate());
		filter.setSelectedProjectId(this.getSelectedProjectId());
		filter.setSelectedProjectName(this.getSelectedProjectName());
		filter.setSelectedRolesCode(this.getSelectedRoleCode());
		filter.setSelectedRolesName(this.getSelectedRoleName());
		filter.setSelectedRolesBefore(this.getSelectedRolesBefore());
		this.getSession().put(REQUIREMENT_FILTER, filter);
	}

	private void loadRequirementFiltersFromSession() {
		if (this.getSession().containsKey(REQUIREMENT_FILTER)
				&& this.getSelectedProjectId() == null) {
			RequirementFilters filter = (RequirementFilters) this.getSession()
					.get(REQUIREMENT_FILTER);
			this.setSelectedStartDate(filter.getStartDate());
			this.setSelectedEndDate(filter.getEndDate());
			this.setSelectedProjectId(filter.getSelectedProjectId());
			this.setSelectedProjectName(filter.getSelectedProjectName());
			this.setSelectedRoleCode(filter.getSelectedRolesCode());
			this.setSelectedRoleName(filter.getSelectedRolesName());
			this.setSelectedRolesBefore(filter.getSelectedRolesBefore());
		}
	}

	@SkipValidation
	public final String filterRequirement() {
		this.loadRequirementFiltersFromSession();
		this.loadSelectedRolesBefore();
		this.loadRequirementList();
		this.saveRequirementFiltersInSession();
		setMappedRequest(MANAGE);
		return SUCCESS;
	}

	private void loadInitialValues() {
		if (!StringUtils.isBlank(this.getSelectedProjectId())) {
			this.setProject(this.getProjectService().searchById(
					Long.parseLong(this.getSelectedProjectId())));
			this.loadDatesFromProject();
		} else {
			this.loadRequirementFiltersFromSession();
		}
		this.loadSelectedRolesBefore();
	}

	private void loadDatesFromProject() {
		this.setSelectedStartDate(this.getProject().getDateStart().getTime());
		Calendar dateEnd = this.getProject().getDateEnd();
		if (dateEnd != null) {
			this.setSelectedEndDate(dateEnd.getTime());
		}
	}

	private void initPreRequirements() {
		if (this.getSession() != null) {
			Object object = this.getSession().get(PREREQUIREMENTS);
			if (object != null) {
				this.setPreRequirements((Collection<Requirement>) object);
			}
		}
	}

	public final String addPreRequirement() {
		this.initPreRequirements();
		Requirement requirement = new Requirement();
		requirement
				.setStartDate(this.toCalendar(this.getRequirementFromDate()));
		requirement.setEndDate(this.toCalendar(this.getRequirementToDate()));
		requirement.setAssignmentPorcentage(Long.parseLong(this
				.getRequirementPercentage()));
		this.getPreRequirements().add(requirement);

		Collection<Skill> skills = CoreServiceLocator.getPersonService().findAllSkills();

		for (Object element : skills) {
			Skill skill = (Skill) element;
			if ((skill.getChildSkills() == null || skill.getChildSkills().isEmpty()) && skill.getParentSkill() != null) {
				String valor = request.getParameter("skill_" + skill.getId());
				if (valor != null && !valor.trim().equals("")) {
					Skill seleccionado = CoreServiceLocator.getPersonService().findSkillById(skill.getId());
					String levelValue = request.getParameter("level_"+ skill.getId());
					Level level = null;
					if (levelValue != null && !levelValue.trim().equals("")) {
						level = CoreServiceLocator.getPersonService().findLanguageLevelById(new Long(levelValue));
					} else {
						List<Level> levels = new ArrayList<Level>(CoreServiceLocator.getPersonService().findAllLevels());
						level = levels.get(0);
					}
					RequirementSkills requirementSkills = new RequirementSkills();
					requirementSkills.setLevel(level);
					requirementSkills.setSkill(seleccionado);
					requirement.getRequirementSkills().add(requirementSkills);
				}
			}
		}
		for (RequirementSkills skill: requirement.getRequirementSkills()) {
			skill.setPercentage( (double) (100/requirement.getRequirementSkills().size()));
		}
		
		this.getSession().put(PREREQUIREMENTS, this.getPreRequirements());
		setMappedRequest(CREATE);
		return SUCCESS;
	}

	public String validateAddPreRequirement() {
		if (getValidated()) {// already validated and accepted the message
			setMappedRequest(CONFIRM_CREATE);
			return SUCCESS;
		}

		Boolean error = Boolean.FALSE;
		// Valido la fecha de inicio.
		if (this.getRequirementFromDate() == null) {
			error = Boolean.TRUE;
			addFieldError("startDate", "Start Date is required.");
		}

		// Valido la fecha de fin.
		if (this.getRequirementToDate() == null) {
			error = Boolean.TRUE;
			addFieldError("endDate", "End Date is required.");
		}

		// Valido la fecha de inicio.
		if ((this.getRequirementFromDate() != null)
				&& (this.getRequirementToDate() != null)
				&& (this.getRequirementFromDate().after(getRequirementToDate()))) {
			error = Boolean.TRUE;
			addFieldError("endDate",
					"End Date cannot precede the Start Date. Verify the date period.");
		}

		// valido que el porcentaje sea menor o igual a 100 y mayor a cero.
		if (StringUtils.isNotEmpty(this.getRequirementPercentage())) {
			Long percentage;
			try {
				percentage = Long.parseLong(this.getRequirementPercentage());
				if ((percentage <= 0) || (percentage > 100)) {
					error = Boolean.TRUE;
					addFieldError("percentage",
							"Percentage must be a number greatear than zero and less or equal to 100.");
				}
			} catch (NumberFormatException e) {
				error = Boolean.TRUE;
				addFieldError("percentage", "Percentage must be a number.");
			}
		} else {
			error = Boolean.TRUE;
			addFieldError("percentage", "Percentage is required.");
		}

		if (error) {
			setMappedRequest(CREATE);
			return INPUT;
		}

		setMappedRequest(CONFIRM_CREATE);
		return SUCCESS;
	}
	
	public final String saveRequirement(){
		Requirement requirement = new Requirement();
		requirement.setStartDate(this.toCalendar(getSelectedStartDate()));
		requirement.setEndDate(this.toCalendar(getSelectedEndDate()));
		requirement.setAssignmentPorcentage(Long.parseLong(this
				.getRequirementPercentage()));

		Collection<Skill> skills = CoreServiceLocator.getPersonService().findAllSkills();

		for (Object element : skills) {
			Skill skill = (Skill) element;
			if ((skill.getChildSkills() == null || skill.getChildSkills().isEmpty()) && skill.getParentSkill() != null) {
				String valor = request.getParameter("skill_" + skill.getId());
				if (valor != null && !valor.trim().equals("")) {
					Skill seleccionado = CoreServiceLocator.getPersonService().findSkillById(skill.getId());
					String levelValue = request.getParameter("level_"+ skill.getId());
					Level level = null;
					if (levelValue != null && !levelValue.trim().equals("")) {
						level = CoreServiceLocator.getPersonService().findLanguageLevelById(new Long(levelValue));
					} else {
						List<Level> levels = new ArrayList<Level>(CoreServiceLocator.getPersonService().findAllLevels());
						level = levels.get(0);
					}
					RequirementSkills requirementSkills = new RequirementSkills();
					requirementSkills.setLevel(level);
					requirementSkills.setSkill(seleccionado);
					requirement.getRequirementSkills().add(requirementSkills);
				}
			}
		}
		for (RequirementSkills skill: requirement.getRequirementSkills()) {
			skill.setPercentage( (double) (100/requirement.getRequirementSkills().size()));
		}
		
		Project project = this.getProjectService().searchById(Long.parseLong(this.getSelectedProjectId()));
		JobFunction role = RecruitServiceLocator.getJobProvider().findFunction(this.getSelectedRoleCode());
		requirement.setRequiredRol(role);
		
		project.addRequirement(requirement);
		this.getProjectService().save(project);
		return SUCCESS;
	}
	
	public final String confirmCreateRequirements() {
		this.initPreRequirements();
		Project project = this.getProjectService().searchById(
				Long.parseLong(this.getRequirementProjectId()));
		JobFunction role = RecruitServiceLocator.getJobProvider().findFunction(
				this.getRequirementRoleCode());
		for (Requirement requirement : this.getPreRequirements()) {
			requirement.setRequiredRol(role);
			project.addRequirement(requirement);
		}
		this.getProjectService().save(project);
		// una vez que guardamos los nuevos requerimientos, borramos la lista de
		// la session.
		this.getSession().remove(PREREQUIREMENTS);
		setMappedRequest(CONFIRM_CREATE);
		return SUCCESS;
	}

	public final String confirmEditRequirement() {
		Project project = this.getProjectService().searchById(
				Long.parseLong(this.getRequirementProjectId()));
		Requirement requirement = findRequirement(project.getRequirements(),
				this.getRequirementId());
		requirement.setAssignmentPorcentage(Double.parseDouble(this
				.getRequirementPercentage()));
		requirement
				.setStartDate(this.toCalendar(this.getRequirementFromDate()));
		requirement.setEndDate(this.toCalendar(this.getRequirementToDate()));
		requirement.setRequiredRol(RecruitServiceLocator.getJobProvider()
				.findFunction(this.getRequirementRoleCode()));
		
		Collection<Skill> skills = CoreServiceLocator.getPersonService().findAllSkills();
		
		requirement.getRequirementSkills().clear();
		
		for (Object element : skills) {
			Skill skill = (Skill) element;
			if ((skill.getChildSkills() == null || skill.getChildSkills().isEmpty()) && skill.getParentSkill() != null) {
				String valor = request.getParameter("skill_" + skill.getId());
				if (valor != null && !valor.trim().equals("")) {
					Skill seleccionado = CoreServiceLocator.getPersonService().findSkillById(skill.getId());
					String levelValue = request.getParameter("level_"+ skill.getId());
					Level level = null;
					if (levelValue != null && !levelValue.trim().equals("")) {
						level = CoreServiceLocator.getPersonService().findLanguageLevelById(new Long(levelValue));
					} else {
						List<Level> levels = new ArrayList<Level>(CoreServiceLocator.getPersonService().findAllLevels());
						level = levels.get(0);
					}
					RequirementSkills requirementSkills = new RequirementSkills();
					requirementSkills.setLevel(level);
					requirementSkills.setSkill(seleccionado);
					
					requirement.getRequirementSkills().add(requirementSkills);
				}
			}
		}
		for (RequirementSkills skill: requirement.getRequirementSkills()) {
			skill.setPercentage( (double) (100/requirement.getRequirementSkills().size()));
		}
		
		this.getProjectService().save(project);
		setMappedRequest(CONFIRM_CREATE);
		return SUCCESS;
	}

	public String validateConfirmEditRequirement() {
		if (getValidated()) {// already validated and accepted the message
			setMappedRequest(CONFIRM_CREATE);
			return SUCCESS;
		}

		Boolean error = Boolean.FALSE;
		// Valido la fecha de inicio.
		if (this.getRequirementFromDate() == null) {
			error = Boolean.TRUE;
			addFieldError("startDate", "Start Date is required.");
		}

		// Valido la fecha de fin.
		if (this.getRequirementToDate() == null) {
			error = Boolean.TRUE;
			addFieldError("endDate", "End Date is required.");
		}

		// Valido la fecha de inicio.
		if ((this.getRequirementFromDate() != null)
				&& (this.getRequirementToDate() != null)
				&& (this.getRequirementFromDate().after(getRequirementToDate()))) {
			error = Boolean.TRUE;
			addFieldError("endDate",
					"End Date cannot precede the Start Date. Verify the date period.");
		}

		// valido que el porcentaje sea menor o igual a 100 y mayor a cero.
		if (StringUtils.isNotEmpty(this.getRequirementPercentage())) {
			Double percentage;
			try {
				percentage = Double.parseDouble(this.getRequirementPercentage());
				if ((percentage <= 0) || (percentage > 100)) {
					error = Boolean.TRUE;
					addFieldError("percentage",
							"Percentage must be a number greatear than zero and less or equal to 100.");
				}
			} catch (NumberFormatException e) {
				error = Boolean.TRUE;
				addFieldError("percentage", "Percentage must be a number.");
			}
		} else {
			error = Boolean.TRUE;
			addFieldError("percentage", "Percentage is required.");
		}

		// // valido que las fechas de inicio y fin del requerimiento este
		// dentro
		// // de las fechas de inicio y fin del proyecto
		// Project project = this.getProjectService().searchById(
		// Long.parseLong(this.getSelectedProjectId()));
		// if (project.getDateStart() != null
		// && this.getSelectedStartDate() != null
		// && (this.getSelectedStartDate().compareTo(
		// project.getDateStart().getTime()) >= 0)) {
		// error = Boolean.TRUE;
		// addFieldError("percentage", "Start date ");
		// }
		if (error) {
			setMappedRequest(CREATE);
			return INPUT;
		}

		setMappedRequest(CONFIRM_CREATE);
		return SUCCESS;
	}

	private Calendar toCalendar(Date date) {
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		return cal;
	}
		
	public Collection<Skill> getSkillsList() {
		return CoreServiceLocator.getPersonService().findAllParentSkill();
	}

	public void setSkillsList(Collection<Skill> skillsList) {
		this.skillsList = skillsList;
	}

	public Map getSession() {
		return session;
	}

	public void setSession(Map session) {
		this.session = session;
	}

	public ProjectService getProjectService() {
		return projectService;
	}

	public void setProjectService(ProjectService projectService) {
		this.projectService = projectService;
	}

	// this prepares command for button on initial screen write
	public void setMappedRequest(String actionMethod) {
		this.mappedRequest = getActionClass() + "_" + actionMethod;
	}

	public String getActionClass() {
		return getClass().getSimpleName();
	}

	public String getMappedRequest() {
		return mappedRequest;
	}

	public String getDestination() {
		return getActionMethod();
	}

	public String getActionMethod() {
		return mappedRequest;
	}

	// when invalid, the request parameter will restore command action
	public void setActionMethod(String method) {
		this.mappedRequest = method;
	}

	public long getRequestId() {
		return requestId;
	}

	public void setRequestId(long requestId) {
		this.requestId = requestId;
	}

	public boolean isReadOnly() {
		return readOnly;
	}

	public String getSelectedProjectName() {
		return selectedProjectName;
	}

	public void setSelectedProjectName(String selectedProjectName) {
		this.selectedProjectName = selectedProjectName;
	}

	public String getSelectedProjectId() {
		return selectedProjectId;
	}

	public void setSelectedProjectId(String selectedProjectId) {
		this.selectedProjectId = selectedProjectId;
	}

	public String getSelectedRoleCode() {
		return selectedRoleCode;
	}

	public void setSelectedRoleCode(String selectedRoleCode) {
		this.selectedRoleCode = selectedRoleCode;
	}

	public String getSelectedRoleName() {
		return selectedRoleName;
	}

	public void setSelectedRoleName(String selectedRoleName) {
		this.selectedRoleName = selectedRoleName;
	}

	public String getSelectedProcentage() {
		return selectedProcentage;
	}

	public void setSelectedProcentage(String selectedProcentage) {
		this.selectedProcentage = selectedProcentage;
	}

	public void setPreRequirements(Collection<Requirement> preRequirements) {
		this.preRequirements = preRequirements;
	}

	public Collection<Requirement> getPreRequirements() {
		return preRequirements;
	}

	public List<JobFunction> getRoles() {
		return RecruitServiceLocator.getJobProvider().findAllJobFunctions();
	}

	public List<Project> getProjectsList() {
		return this.getProjectService().findAll();
	}

	public Collection<String> getSelectedRolesBefore() {
		return selectedRolesBefore;
	}

	public void setSelectedRolesBefore(Collection<String> selectedRolesBefore) {
		this.selectedRolesBefore = selectedRolesBefore;
	}

	private void loadSelectedRolesBefore() {
		if (this.getSelectedRolesBefore() == null) {
			this.setSelectedRolesBefore(new ArrayList<String>());
		}
		if (selectedRoles != null) {
			String[] rolesArray = StringUtils.split(selectedRoles, ',');
			// Se hace un trim para sacar caracteres de espacio que pueden
			// volver del combo
			for (int i = 0; i < rolesArray.length; i++) {
				rolesArray[i] = StringUtils.trim(rolesArray[i]);
			}
			CollectionUtils.addAll(this.getSelectedRolesBefore(), rolesArray);
		}
	}

	public void setFilteredRequirementList(
			Collection<Requirement> filteredRequirementList) {
		this.filteredRequirementList = filteredRequirementList;
	}

	public Collection<Requirement> getFilteredRequirementList() {
		return filteredRequirementList;
	}

	public void setProject(Project project) {
		this.project = project;
	}

	public Project getProject() {
		return project;
	}

	public String getRequirementId() {
		return requirementId;
	}

	public void setRequirementId(String requirementId) {
		this.requirementId = requirementId;
	}

	public void setRequirementToDelete(String requirementToDelete) {
		this.requirementToDelete = requirementToDelete;
	}

	public String getRequirementToDelete() {
		return requirementToDelete;
	}

	public void setSelectedStartDate(Date selectedStartDate) {
		this.selectedStartDate = selectedStartDate;
	}

	public Date getSelectedStartDate() {
		return selectedStartDate;
	}

	public void setSelectedEndDate(Date selectedEndDate) {
		this.selectedEndDate = selectedEndDate;
	}

	public Date getSelectedEndDate() {
		return selectedEndDate;
	}

	public String getSelectedRoles() {
		return selectedRoles;
	}

	public void setSelectedRoles(String selectedRoles) {
		this.selectedRoles = selectedRoles;
	}

	@SkipValidation
	public final String editRequirement() {
		if (StringUtils.isNotBlank(this.getSelectedProjectId())) {
			this.setRequirementProjectId(this.selectedProjectId);
		}
		Project project = this.getProjectService().searchById(
				Long.valueOf(this.getRequirementProjectId()));
		Requirement requirement = findRequirement(project.getRequirements(),
				this.getRequirementId());
		this.setRequirementFromDate(requirement.getStartDate().getTime());
		this.setRequirementToDate(requirement.getEndDate().getTime());
		this.setRequirementPercentage(String.valueOf(requirement
				.getAssignmentPorcentage()));
		this.setRequirementProjectName(project.getName());
		this.setRequirementRoleCode(requirement.getRequiredRol().getCode());
		this.setRequirementRoleName(requirement.getRequiredRol()
				.getDescription());
		setMappedRequest(EDIT);
		return SUCCESS;
	}

	private Requirement findRequirement(Set<Requirement> requirementSet,
			String requirementId) {
		Requirement toReturn = null;
		if (StringUtils.isNotBlank(requirementId)) {
			Long id = Long.parseLong(requirementId);
			for (Requirement requirement : requirementSet) {
				if (requirement.getId().equals(id)) {
					toReturn = requirement;
					break;
				}
			}
		}
		return toReturn;
	}

	public String getRequirementProjectName() {
		return requirementProjectName;
	}

	public void setRequirementProjectName(String requirementProjectName) {
		this.requirementProjectName = requirementProjectName;
	}

	public String getRequirementRoleCode() {
		return requirementRoleCode;
	}

	public void setRequirementRoleCode(String requirementRoleCode) {
		this.requirementRoleCode = requirementRoleCode;
	}

	public String getRequirementRoleName() {
		return requirementRoleName;
	}

	public void setRequirementRoleName(String requirementRoleName) {
		this.requirementRoleName = requirementRoleName;
	}

	public Date getRequirementFromDate() {
		return requirementFromDate;
	}

	public void setRequirementFromDate(Date requirementFromDate) {
		this.requirementFromDate = requirementFromDate;
	}

	public Date getRequirementToDate() {
		return requirementToDate;
	}

	public void setRequirementToDate(Date requirementToDate) {
		this.requirementToDate = requirementToDate;
	}

	public String getRequirementPercentage() {
		return requirementPercentage;
	}

	public void setRequirementPercentage(String requirementPercentage) {
		this.requirementPercentage = requirementPercentage;
	}

	public String getRequirementProjectId() {
		return requirementProjectId;
	}

	public void setRequirementProjectId(String requirementProjectId) {
		this.requirementProjectId = requirementProjectId;
	}

	public Boolean getValidated() {
		return validated;
	}

	public void setPermissionChecker(PermissionChecker permissionChecker) {
		this.permissionChecker = permissionChecker;
	}

	public PermissionChecker getPermissionChecker() {
		return permissionChecker;
	}

	public void setPermissionNameConverter(PermissionNameConverter permissionNameConverter) {
		this.permissionNameConverter = permissionNameConverter;
	}

	public PermissionNameConverter getPermissionNameConverter() {
		return permissionNameConverter;
	}

	@Override
	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}
}
